import instacne from "../request";
import type { Ref } from "vue";
import qs from "qs"
import { id } from "element-plus/es/locale";


/**
 * 登录返回数据
 */
interface IAdminLoginParams {
  password: string;
  username: string;
}
interface IAdminLoginRes {
  tokenHead: string;
  token: string;
}
const adminLogin = (data: IAdminLoginParams): Promise<IAdminLoginRes> => {
  // instacne.post("/auth/login", data); 是一个 Promise 类型
  return instacne.post("/admin/login", data);
};

/**
 * 获取当前登录用户信息
 */
interface IAdminInfoRes {
  menus: IMneuItem[];
  icon: string;
  username: string;
  roles: string[];
}
const getAdminInfo = (): Promise<IAdminInfoRes> => {
  return instacne.get("/admin/info");
};
interface IAdminziyuanRes {
  categoryId: number,
  createTime: string,
  description: string,
  id: number,
  name: string,
  url: string
}

/**
 * /admin/list 根据用户名或者姓名获取用户列表
 */
interface IAdminListParams {
  keyword?: string | Ref<string>;
  pageNum?: number | Ref<number>;
  pageSize?: number | Ref<number>;
  name?: string | Ref<string>;
  type?: number | Ref<number>;
}
interface IAdminListItem {
  createTime: string;
  email: string;
  icon: string;
  id: number;
  loginTime: string;
  nickName: string;
  note: string;
  password: string;
  status: number;
  username: string;
  name: string;
}
interface IAdminListRes {
  list: IAdminListItem[];
  pageNum: number;
  pageSize: number;
  total: number;
  totalPage: number;
}
interface IOrdersetting {
  id: number;
  code: number;
  data: {
    commentOvertime: number;
    confirmOvertime: number;
    finishOvertime: number;
    flashOrderOvertime: number;
    id: number;
    normalOrderOvertime: number;
  };
  message: string;
}
interface IAdvertise {
  code: number;
  data: {
    list: [
      {
        clickCount: number;
        endTime: string;
        id: number;
        name: string;
        note: string;
        orderCount: number;
        pic: string;
        sort: number;
        startTime: string;
        status: number;
        type: number;
        url: string;
      }
    ];
    pageNum: number;
    pageSize: number;
    total: number;
    totalPage: number;
  };
  message: string;
}

interface IAdminAdd {
  name: string;
  id: number;
}
interface IAdminziyuanRes {
  categoryId: number;
  createTime: string;
  description: string;
  id: number;
  name: string;
  url: string;
}

// 文件上传的接口
interface IMinioDelete {
  code: number,
  data: any,
  message: string
}

// 根据编号查询品牌信息接口
interface IBrand {
  code: number,
  data: {
    bigPic: string,
    brandStory: string,
    factoryStatus: number,
    firstLetter: string,
    id: number,
    logo: string,
    name: string,
    productCommentCount: number,
    productCount: number,
    showStatus: number,
    sort: number
  },
  message: string,
  pageNum: number,
  pageSize: number,
  list: {}
}

const getAdminList = (
  data?: IAdminListParams | any
): Promise<IAdminListRes> => {
  return instacne.get("/admin/list", {
    params: data,
  });
};
/**
 * 新增用户
 * admin/register
 */
const adminRegister = (data: IAdminListItem): Promise<IAdminListItem> => {
  return instacne.post("/admin/register", data);
};
/**
 * /admin/update/{id}
 *  修改指定用户信息
 */
const adminUpdate = (data: IAdminListItem) => {
  return instacne.post(`/admin/update/${data.id}`, data);
};
// 获取资源列表
interface ziyuanCS {
  categoryId?: number;
  nameKeyword?: string;
  pageNum?: number;
  pageSize?: number;
  urlKeyword?: string
}
interface ziyuanList {
  categoryId: number,
  createTime: string,
  description: string,
  id: number,
  name: string,
  url: string
}
interface ziyuanRes {
  list: ziyuanList[],
  pageNum: number,
  pageSize: number,
  total: number,
  totalPage: number
}
const adminziyuanList = (data?: ziyuanCS): Promise<ziyuanRes> => {
  return instacne.get("/resource/list", {
    params: data
  });
};
// 秒杀活动详情/flash/list
// 获取活动详情

// Parameters
interface IAdminMSList {
  keyword?: string | Ref<string>;
  pageNum?: number | Ref<number>;
  pageSize?: number | Ref<number>;
}
interface IAdminmsList {
  createTime: string;
  endDate: string;
  id: number;
  startDate: string;
  title: string;
}
interface IAdminMsRes {
  list: any;
  pageNum: number;
  pageSize: number;
  total: number;
  totalPage: number;
}

//文件上传接口
interface IAdminMinioUpdate{
  code:number,
  data: {},
  message: string
}
const adminmsList = (data?: IAdminMSList): Promise<IAdminMsRes> => {
  return instacne.get("/flash/list", {
    params: data,
  });
};


//批量删除推荐品牌接口
interface IHomeBrandDelete  {
  
 
  ids:[]

}
//文件上传
const adminminioupload = (data: IAdminMinioUpdate): Promise<IAdminMinioUpdate> => {
  return instacne.post(`minio/upload`,data)
}
//批量删除推荐品牌
const homebranddele = (data: IHomeBrandDelete): Promise<IHomeBrandDelete> => {
  return instacne.post(`/home/brand/delete`,null,{params:data.ids })
}

// /attrInfo/{productCategoryId} 商品属性列表

const attribute = (data?: IAdminListParams): Promise<IAdminListRes> => {
  return instacne.get("/productAttribute/category/list", {
    params: data,
  });
};
// /productAttribute/create 商品属性添加
interface IAdminDelete {
  filterType: number;
  handAddStatus: number;
  inputList: string;
  inputType: number;
  name: string;
  productAttributeCategoryId: number;
  relatedStatus: number;
  searchType: number;
  selectType: number;
  sort: number;
  type: number;
}
// 添加属性列表
interface AdminAdd {
  name: string,
  id: number,
}
const adminAddForm = (data: AdminAdd): Promise<IAdminListItem> => {

  return instacne.post("/productAttribute/category/create", qs.stringify(data))
}
// 删除属性列表
const adminDeleteForm = (data: number): Promise<IAdminDelete> => {
  return instacne.get(`/productAttribute/category/delete/${data}`);
};
// 编辑属性列表
const adminListbj = (data: IAdminAdd): Promise<IAdminDelete> => {
  let datas = {
    name: data.name
  }
  return instacne.post(`/productAttribute/category/update/${data.id}`, qs.stringify(datas))
}

// 退货列表
const returnGoodsAll = (data?: IAdminListParams): Promise<IAdminListRes> => {
  return instacne.get("/returnReason/list", {
    params: data,
  });
};

// 添加退货请求
interface IAddReturnGoods {
  createTime: string;
  id: number;
  name: string;
  sort: number;
  status: number;
}

export const addReturnGoods = (
  data: IAddReturnGoods
): Promise<IAddReturnGoods> => {
  return instacne.post("/returnReason/create", data);
};

// returnReason/update/{id}
// 修改退货原因
const changeReturnGoods = (data: IAddReturnGoods): Promise<IAddReturnGoods> => {
  return instacne.post(`/returnReason/update/${data.id}`, data);
};

// 修改退货原因状态
interface IgoodsStatus {
  ids: number;
  status: number;
}
const changeReturnGoodsStatus = (data: IgoodsStatus): Promise<IgoodsStatus> => {
  return instacne.post(
    `/returnReason/update/status?status=${data.status}&ids=${data.ids}`
  );
};

// 删除退货原因
const delRouterGoods = (data: number): Promise<null> => {
  return instacne.post(`/returnReason/delete?ids=${data}`);
};
// /productAttribute/list/{cid} 商品属性列表
const AttributeList = (
  data: AttributeListItiem | undefined
): Promise<IAdminListRes> => {
  console.log(data);

  return instacne.get(`/productAttribute/list/${data?.cid}`, {
    params: {
      pageNum: data?.pageNum,
      pageSize: data?.pageSize,
      type: data?.type,
    },
  });
};
interface AttributeListItiem {
  cid?: number;
  pageNum?: number;
  pageSize?: number;
  type?: number;
}

// 添加商品属性

const AddGoods = (data: IAdminListItem): Promise<IAdminListItem> => {
  return instacne.post("/productAttribute/create", data);
};
interface AddGoodsItem {
  filterType: number;
  handAddStatus: number;
  inputList: string;
  inputType: number;
  name: string;
  productAttributeCategoryId: number;
  relatedStatus: number;
  searchType: number;
  selectType: number;
  sort: number;
  type: number;
}
// /productAttribute/list 参数列表
const CsList = (data: AttributeListItiem): Promise<AttributeListItiem> => {
  return instacne.post(`/productAttribute/list${data?.cid}`, {
    params: {
      pageNum: data?.pageNum,
      pageSize: data?.pageSize,
      type: data?.type,
    },
  });
};
// 角色列表
interface getAdminResources {
  keyword?: string | Ref<string>;
  pageNum?: number | Ref<number>;
  pageSize?: number | Ref<number>;
}
const getAdminallowMenu = (id: number): Promise<any[]> => {
  return instacne.get(`/role/listMenu/${id}`);
};
const getAdminRole = (data?: getAdminResources): Promise<IAdminListRes> => {
  return instacne.get("/role/list", {
    params: data,
  });
};
interface IRoleListItem {
  adminCount: number;
  createTime: string;
  description: string;
  id: number;
  name: string;
  sort: number;
  status: number;
}
//  角色列表新增
const rolesRegister = (data: IRoleListItem): Promise<IRoleListItem> => {
  return instacne.post("/role/create", data);
};

// /flash/update/status/{id}修改上下线状态

interface sxdata {
  id: number | Ref<number>;
  status: number | Ref<number>;
}
const changeSX = (data: sxdata) => {
  return instacne.post(`/flash/update/status/${data.id}?status=${data.status}`);
};

// 优惠卷列表 /coupon/list
const couponCouponsList = (data?: IAdminListParams | any): Promise<IAdminListRes> => {
  return instacne.get("/coupon/list", {
    params: data,
  });
};

// 添加优惠券
interface IAddCoupon {
  amount: number;
  code: string;
  count: number;
  enableTime: string;
  endTime: string;
  id: number;
  memberLevel: number;
  minPoint: number;
  name: string;
  note: string;
  perLimit: number;
  platform: number;
  productCategoryRelationList: [
    {
      couponId: number;
      id: number;
      parentCategoryName: string;
      productCategoryId: string;
      productCategoryName: string;
    }
  ];
  productRelationList: [
    {
      couponId: number;
      id: number;
      productId: number;
      productName: string;
      productSn: string;
    }
  ];
  publishCount: number;
  receiveCount: number;
  startTime: string;
  type: number;
  useCount: number;
  useType: number;
}

//品牌推荐的接口
interface IBrandList {
  list: never[];
  total(total: any): number;
  code: number;
  data: {
    list: [
      {
        list:[]
        brandId: number;
        brandName: string;
        id: number;
        recommendStatus: number;
        sort: number;
      }
    ];
    pageNum: number;
    pageSize: number;
    total: number;
    totalPage: number;
  };
  message: string;
}

//新品推荐的接口
interface INewProductList {
  list: never[];
  total(total: any): number;
  code: number;
  data: {
    list: [
      {
        id: number;
        productId: number;
        productName: string;
        recommendStatus: number;
        sort: number;
      }
    ];
    pageNum: number;
    pageSize: number;
    total: number;
    totalPage: number;
  };
  message: string;
}

//批量删除品牌的接口
interface IBrandDelete {

  code: number,
  data: {},
  message: string

}

//查询商品的接口
interface IProductList {
  code: number,
  data: {
    list: [
      {
        list: [],
        albumPics: string,
        brandId: number,
        brandName: string,
        deleteStatus: number,
        description: string,
        detailDesc: string,
        detailHtml: string,
        detailMobileHtml: string,
        detailTitle: string,
        feightTemplateId: number,
        giftGrowth: number,
        giftPoint: number,
        id: number,
        keywords: string,
        lowStock: number,
        name: string,
        newStatus: number,
        note: string,
        originalPrice: number,
        pic: string,
        previewStatus: number,
        price: number,
        productAttributeCategoryId: number,
        productCategoryId: number,
        productCategoryName: string,
        productSn: string,
        promotionEndTime: string
        promotionPerLimit: number,
        promotionPrice: number,
        promotionStartTime: string,
        promotionType: number,
        publishStatus: number,
        recommandStatus: number,
        sale: number,
        serviceIds: string,
        sort: number,
        stock: number,
        subTitle: string,
        unit: string,
        usePointLimit: number,
        verifyStatus: number,
        weight: number
      }
    ],
    pageNum: number,
    pageSize: number,
    total: number,
    totalPage: number
  },
  message: string
}

//获取广告详情接口
interface IHomeAdvertise {
  code: number,
  data: {
    clickCount: number,
    endTime: string,
    id: number,
    name: string,
    note: string,
    orderCount: number,
    pic: string,
    sort: number,
    startTime: string,
    status: number,
    type: number,
    url: string
  },
  message: string
}


const addCoupon = (data: IAddCoupon): Promise<IAddCoupon> => {
  return instacne.get("/coupon/create", {
    params: data,
  });
}

interface IAddCouponData {
  children: [
    {
      description: string,
      icon: string,
      id: number,
      keywords: string,
      level: number,
      name: string,
      navStatus: number,
      parentId: number,
      productCount: number,
      productUnit: string,
      showStatus: number,
      sort: number
    }
  ],
  description: string,
  icon: string,
  id: number,
  keywords: string,
  level: number,
  name: string,
  navStatus: number,
  parentId: number,
  productCount: number,
  productUnit: string,
  showStatus: number,
  sort: number
}


// 优惠券标题 /productCategory/list/withChildren
const getTitleLists = (): Promise<IAddCouponData[]> => {
  return instacne.get("/productCategory/list/withChildren")
}
// 获取需要编辑的优惠券
const getOnecoupon = (id: number): Promise<IAddCoupon> => {
  return instacne.get(`/coupon/${id}`)
}
// 修改优惠券
const UpdateOnecoupon = (id: number, data: IAddCoupon): Promise<IAddCoupon> => {
  return instacne.post(`/coupon/update/${id}`, data)
}

interface IqueryCoupon {
  couponId?: number | Ref<number>
  orderSn?: string | Ref<string>
  useStatus?: number | Ref<number>
  pageNum?: number | Ref<number>;
  pageSize?: number | Ref<number>;

}
interface IqueryCouponData {
  list: [
    {
      couponCode: string,
      couponId: number,
      createTime: string,
      getType: number,
      id: number,
      memberId: number,
      memberNickname: string,
      orderId: number,
      orderSn: string,
      useStatus: number,
      useTime: string
    }
  ],
  pageNum: number,
  pageSize: number,
  total: number,
  totalPage: number
}
// 查询具体的优惠券 /couponHistory/list
const queryCouponData = (data?: IqueryCoupon): Promise<IqueryCouponData> => {
  return instacne.get("/couponHistory/list", {
    params: data
  })

}

// 删除对应的优惠券列表 /coupon/delete
const delCouponItem = (data: number): Promise<Object> => {
  return instacne.post("/coupon/delete/" + data)

}
// 退货申请处理列表 returnApply/list
interface IreturnApplyList {
  list: [
    {
      companyAddressId: number,
      createTime: string,
      description: string,
      handleMan: string,
      handleNote: string,
      handleTime: string,
      id: number,
      memberUsername: string,
      orderId: string,
      orderSn: string,
      productAttr: string,
      productBrand: string,
      productCount: number,
      productId: number,
      productName: string,
      productPic: string,
      productPrice: number,
      productRealPrice: number,
      proofPics: string,
      reason: string,
      receiveMan: string,
      receiveNote: string,
      receiveTime: string,
      returnAmount: number,
      returnName: string,
      returnPhone: string,
      status: number
    }
  ],
  pageNum: number,
  pageSize: number,
  total: number,
  totalPage: number
}
interface IreturnApply {
  createTime?: string | Ref<string>
  handleMan?: string | Ref<string>
  handleTime?: string | Ref<string>
  id?: number | Ref<number>
  pageNum?: number | Ref<number>
  pageSize?: number | Ref<number>
  receiverKeyword?: string | Ref<string>
  status?: number | Ref<number>
}

//商品删除的接口
interface IHomeNewProductDelete{
  // code: number,
  // data: {},
  // message: string,
  pageNum?: number | Ref<number>
  pageSize?: number | Ref<number>
  ids: number
  
}

const returnApplyList = (data?: IreturnApply): Promise<IreturnApplyList> => {
  return instacne.get("/returnApply/list", {
    params: data,
  });
}

// /returnApply/delete
const deleteReturnApplyList = (data: number): Promise<IreturnApplyList> => {
  return instacne.get("/returnApply/list?ids=" + data);
}
// 退货订单
interface Ireturnorder {
  autoConfirmDay: number
  billContent: string
  billHeader: string
  billReceiverEmail: string
  billReceiverPhone: string
  billType: number
  commentTime: string
  confirmStatus: number
  couponAmount: number
  couponId: number
  createTime: string
  deleteStatus: number
  deliveryCompany: string
  deliverySn: string
  deliveryTime: string
  discountAmount: number
  freightAmount: number
  growth: string
  historyList: [{
    createTime: string
    id: number
    note: string
    operateMan: string
    orderId: number
    orderStatus: number
  }]
  id: number
  integration: number
  integrationAmount: number
  memberId: number
  memberUsername: string
  modifyTime: string
  note: string
  orderItemList: [{
    couponAmountcouponAmount: string
    giftIntegration: string
    id: number
    integrationAmount: string
    orderId: number
    orderSn: string
    productAttr: [{
      key: string,
      value: string
    }]
    productBrand: string
    productCategoryId: number
    productId: number
    productName: string
    productPic: string
    productPrice: number
    productQuantity: number
    productSkuCode: string
    productSkuId: number
    productSn: string
    promotionAmount: string
    promotionName: string
    realAmount: string
  }]
  orderSn: string
  orderType: number
  payAmount: number
  payType: number
  paymentTime: string
  promotionAmount: number
  promotionInfo: string
  receiveTime: string
  receiverCity: string
  receiverDetailAddress: string
  receiverName: string
  receiverPhone: string
  receiverPostCode: string
  receiverProvince: string
  receiverRegion: string
  sourceType: number
  status: number
  totalAmount: number
  useIntegration: string
}
// order
const returnorder = (data: number): Promise<Ireturnorder> => {
  return instacne.get("/order/" + data);
}

interface IDataFace {
  companyAddress: {
    addressName: string
    city: boolean
    detailAddress: string
    id: number
    name: string
    phone: string
    province: string
    receiveStatus: number
    region: string
    sendStatus: number
  }
  companyAddressId: number
  createTime: string
  description: string
  handleMan: string
  handleNote: string
  handleTime: string
  id: number
  memberUsername: string
  orderId: number
  orderSn: string
  productAttr: string
  productBrand: string
  productCount: number
  productId: number
  productName: string
  productPic: string
  productPrice: number
  productRealPrice: number
  proofPics: string
  reason: string
  receiveMan: string
  receiveNote: boolean
  receiveTime: string
  returnAmount: number
  returnName: string
  returnPhone: string
  status: number
}

// 单个退回详情数据
let returnApplyitem = (data: number): Promise<IDataFace> => {
  return instacne.get("/returnApply/" + data);
}
// 角色列表 分配菜单
const Distributionmenu = (): Promise<allocMenu> => {
  return instacne.get("/menu/treeList")
}

interface allocMenu {
  createTime: string
  hidden: number
  icon: string
  id: number
  level: number
  name: string
  parentId: number
  sort: number
  title: string
  rawValue: Object
}

interface AdminNum {
  cid?: number
  pageNum: number
  pageSize: number
}
const AdminNumSize = (data: AdminNum | undefined): Promise<IAdminListRes> => {
  console.log(data);

  return instacne.get(`/productAttribute/category/list`, {
    params: {
      pageNum: data?.pageNum,
      pageSize: data?.pageSize,
    }

  })
}
// 添加商品属性/productAttribute/create
interface AdminAddCategory {
  filterType: number,
  handAddStatus: number,
  inputList: string,
  inputType: number,
  name: string,
  productAttributeCategoryId: number,
  relatedStatus: number,
  searchType: number,
  selectType: number,
  sort: number
  type: number
}
const AdminAddItem = (data: AdminAddCategory): Promise<AdminAddCategory> => {
  console.log(data);

  return instacne.post(`/productAttribute/create`, {
    params: {

    }
  })
}
// 商品分类 /productCategory/list
interface AdminAddCategoryList {
  pageNum: number,
  pageSize: number,
  parentId: number,
}
const AdminAddCategoryItem = (data: AdminAddCategoryList): Promise<IAdminListRes> => {
  console.log(data);

  return instacne.get(`/productCategory/list/0`, {
    params: {
      pageNum: data?.pageNum,
      pageSize: data?.pageSize,
    }
  })
}


//订单设置
const orderSetting = (data: IOrdersetting): Promise<IOrdersetting> => {
  // console.log(data.id);

  return instacne.get(`/orderSetting/${data.id}`);
  // 优惠券标题 /productCategory/list/withChildren

};
const getTitleList = (): Promise<IAdminInfoRes> => {
  return instacne.get("/productCategory/list/withChildren");
};
//封装品牌推荐请求
const brandlist = (data: IBrandList): Promise<IBrandList> => {
  return instacne.get(`/home/brand/list`, {params:data});
};
//封装新品推荐的请求
const newProduct = (data: INewProductList): Promise<INewProductList> => {
  return instacne.get(`/home/newProduct/list`, {
   params:data
  });
};
//封装广告请求
const homeAdvertise = (data: any): Promise<any> => {
  return instacne.get(`/home/advertise/list`, {params:data});
};


// /mall-admin/brand/listAll 获取全部品牌列表
interface listParams {
  keyword?: string | Ref<string>;
  pageNum?: number | Ref<number>;
  pageSize?: number | Ref<number>;
}
interface listAllList {
  bigPic: string,
  brandStory: string,
  factoryStatus: number,
  firstLetter: string,
  id: number,
  logo: string,
  name: string,
  productCommentCount: number,
  productCount: number,
  showStatus: number,
  sort: number
}
interface listAllRes {
  list: listAllList[],
  id: number,
  pageNum: number,
  pageSize: number,
  total: number,
  totalPage: number
}
const listAll = (data?: listParams | any): Promise<listAllRes> => {
  // console.log(data);
  return instacne.get("/brand/list",
    {
      params: data,
    }
  )
}

// 根据编号查询品牌信息 /mall-admin/brand/{id}
interface ppinfoRes {
  bigPic: string,
  brandStory: string,
  factoryStatus: number
  firstLetter: string,
  id: number,
  logo: string,
  name: string,
  productCommentCount: number,
  productCount: number,
  showStatus: number,
  sort: number
}
const findppinfo = (id: number): Promise<ppinfoRes> => {
  return instacne.get(`/brand/${id}`)
}
//根据变化查询品牌信息
const brand = (data: IBrand): Promise<IBrand> => {
  return instacne.get(`http://xue.cnkdl.cn:9082/mall-admin/brand/list`, data)
}
// 品牌推荐删除按钮
const homenewproductdelete = (data: IHomeNewProductDelete): Promise<IHomeNewProductDelete> => {
  return instacne.post(`http://xue.cnkdl.cn:9082/mall-admin/home/advertise/delete`,null,{params:{ids:data.ids}})
}

// /home/recommendSubject/list分页查询推荐
interface TjRequse {
  pageNum?: number | Ref<number>;
  pageSize?: number | Ref<number>;
  recommendStatus?: number | Ref<number>
  subjectName?: string | Ref<string>;

}
interface TjLIST {
  id: number,
  recommendStatus: number,
  sort: number,
  subjectId: number,
  subjectName: string
}
interface TjRes {
  sort?: number;
  list: TjLIST[],
  pageNum: number,
  pageSize: number,
  total: number,
  totalPage: number,
  id: number
}
const TjList = (data?: TjRequse): Promise<TjRes> => {
  return instacne.get('/home/recommendSubject/list', {
    params: data
  })
}


  

// 修改推荐排序
interface Sort {
  id: number | Ref<number>,
  sort?: number
}
const changeSort = (data: Sort): Promise<any> => {
  return instacne.post(`/home/recommendSubject/update/sort/${data.id}?sort=${data.sort}&id=${data.id}`)
}

const productList = (data: any): Promise<any> => { 
  return instacne.get(`/product/list`,data)
}

//获取广告详情
// 专题推荐中的删除功能 /home/recommendSubject/delete批量删除推荐
interface IDS {
  ids: number
}

const delTj = (ids: IDS): Promise<any> => {
  return instacne.post('/home/recommendSubject/delete', qs.stringify({ ids: ids }))

}
// 根据专题名称分页获取专题 /subject/list
interface ZtCS {
  keyword?: string | Ref<string>;
  pageNum?: number | Ref<number>;
  pageSize?: number | Ref<number>;
}
interface ZtList {
  albumPics: string,
  categoryId: number,
  categoryName: string,
  collectCount: number,
  commentCount: number,
  content: string,
  createTime: string,
  description: string,
  forwardCount: number,
  id: number,
  pic: string,
  productCount: number,
  readCount: number,
  recommendStatus: number,
  showStatus: number,
  title: string
}
interface ZtRes {
  list: ZtList[],
  pageNum: number,
  pageSize: number,
  total: number,
  totalPage: number
}

const ZtQQ = (data?: ZtCS | undefined): Promise<ZtRes> => {
  // console.log(data);

  return instacne.get('/subject/list', {
    params: data
  })
}
// /order/list查询订单
interface orderCS {
  createTime?: string;
  orderSn?: string;
  orderType?: number;
  pageNum?: number;
  pageSize?: number;
  receiverKeyword?: string;
  sourceType?: number;
  status?: number
}
interface orderList {
  autoConfirmDay: number,
  billContent: string,
  billHeader: string,
  billReceiverEmail: string,
  billReceiverPhone: string,
  billType: number,
  commentTime: string,
  confirmStatus: number,
  couponAmount: number,
  couponId: number,
  createTime: string,
  deleteStatus: number,
  deliveryCompany: string,
  deliverySn: string,
  deliveryTime: string,
  discountAmount: number,
  freightAmount: number,
  growth: number,
  id: number,
  integration: number,
  integrationAmount: number,
  memberId: number,
  memberUsername: string,
  modifyTime: string,
  note: string,
  orderSn: string,
  orderType: number,
  payAmount: number,
  payType: number,
  paymentTime: string,
  promotionAmount: number,
  promotionInfo: string,
  receiveTime: string,
  receiverCity: string
  receiverDetailAddress: string,
  receiverName: string
  receiverPhone: string
  receiverPostCode: string,
  receiverProvince: string,
  receiverRegion: string,
  sourceType: number,
  status: number,
  totalAmount: number,
  useIntegration: number
}
interface orderRes {
  list: orderList[],
  pageNum: number,
  pageSize: number,
  total: number,
  totalPage: number
}
const orderQQ = (data?: orderCS): Promise<orderRes> => {
  return instacne.get('order/list', { params: data })
}
// 编辑role/update/
interface Iorderbjs {
  adminCount: number,
  createTime: string,
  description: string,
  id: number,
  name: number,
  sort: number,
  status: number
}
const orderbj = (data: Iorderbjs): Promise<Iorderbjs> => {
  return instacne.post(`role/update/${data.id}`, data)
}
// 秒杀活动全部场 /flashSession/list
interface msAllRES {
  createTime: string,
  endTime: string,
  id: number,
  name: string,
  startTime: string,
  status: number
}
const msAll = (): Promise<msAllRES[]> => {
  return instacne.get('/flashSession/list')
}
// 添加秒杀活动场次
interface createCs {
  createTime: string,
  endTime: string,
  id: number,
  name: string,
  startTime: string,
  status: number
}
const createQQ = (data: createCs): Promise<any> => {
  return instacne.post('flashSession/create', data)
}
// /flashSession/delete/{id} 删除秒杀场次
const delMS = (id: number): Promise<any> => {
  return instacne.post(`/flashSession/delete/${id}`)
}
// 获取全部可选场次及其数量
interface selectRes {
  createTime: string,
  endTime: string,
  id: number,
  name: string,
  productCount: string,
  startTime: string,
  status: number
}
const selectQQ = (flashPromotionId?: number): Promise<selectRes[]> => {
  return instacne.get(`flashSession/selectList?flashPromotionId=${flashPromotionId}`)
}
// /flashProductRelation/list分页查询不同场次关联及商品信息
interface flashProductRelationCS {
  flashPromotionId: number,
  flashPromotionSessionId: number,
  pageNum?: number,
  pageSize?: number
}
interface flashProductRelationList {
  flashPromotionCount: number,
  flashPromotionId: number,
  flashPromotionLimit: number,
  flashPromotionPrice: number,
  flashPromotionSessionId: number,
  id: number,
  productId: number,
  sort: number
  product: {
    albumPics: string,
    brandId: number,
    brandName: string,
    deleteStatus: number,
    description: string,
    detailDesc: string,
    detailHtml: string,
    detailMobileHtml: string,
    detailTitle: string,
    feightTemplateId: number,
    giftGrowth: number,
    giftPoint: number,
    id: number,
    keywords: string,
    lowStock: number,
    name: string,
    newStatus: number,
    note: string,
    originalPrice: number,
    pic: string,
    previewStatus: number,
    price: number,
    productAttributeCategoryId: number,
    productCategoryId: number,
    productCategoryName: string,
    productSn: string,
    promotionEndTime: string,
    promotionPerLimit: number,
    promotionPrice: number,
    promotionStartTime: string,
    promotionType: number,
    publishStatus: number,
    recommandStatus: number,
    sale: number,
    serviceIds: string,
    sort: number,
    stock: number,
    subTitle: string,
    unit: string,
    usePointLimit: number,
    verifyStatus: number,
    weight: number
  }
}
interface flashProductRelationRes {
  list: flashProductRelationList[]
  pageNum: number,
  pageSize: number,
  total: number,
  totalPage: number
}
const flashProductRelationQQ = (data: flashProductRelationCS): Promise<flashProductRelationRes> => {
  return instacne.get('/flashProductRelation/list', {
    params: data
  })
}




export type {
  TjRes, Sort,
  IAdminLoginParams, IAdminLoginRes, IAdminListItem, IAdminAdd, IAdminDelete, IAddReturnGoods, IgoodsStatus, IOrdersetting, IAdvertise, IAdminmsList, IAdminMsRes, IAddCoupon, sxdata, AttributeListItiem, AddGoodsItem, getAdminResources, IRoleListItem, IBrandList, INewProductList, IMinioDelete, IBrandDelete, IProductList, IHomeAdvertise, IAdminziyuanRes,
  IAddCouponData,
  IqueryCouponData,
  IreturnApplyList,
  AdminAdd,
  IDataFace,
  listAllRes, ppinfoRes, IAdminListRes, Ireturnorder,
  msAllRES, selectRes, flashProductRelationCS, flashProductRelationRes,
  IBrand,IHomeNewProductDelete,IHomeBrandDelete,IAdminMinioUpdate,  deleteReturnApplyList,
  returnApplyitem, returnorder,
  Distributionmenu, AdminNumSize, AdminAddItem, AdminAddCategoryItem, listAll, findppinfo, TjList, changeSort,
  brand, homenewproductdelete, delTj
};
export {
  flashProductRelationQQ,
  selectQQ,
  delMS,
  createQQ,
  msAll,
  orderQQ,
  ZtQQ,
  adminLogin,
  getAdminInfo,
  getAdminList,
  adminRegister,
  adminUpdate,
  attribute,
  adminAddForm,
  adminDeleteForm,
  adminListbj,
  returnGoodsAll,
  changeReturnGoods,
  changeReturnGoodsStatus,
  delRouterGoods,
  adminmsList,
  couponCouponsList,
  addCoupon,
  changeSX,
  AttributeList,
  AddGoods,
  CsList,
  getAdminallowMenu,
  getAdminRole,
  orderSetting,
  rolesRegister,
  brandlist,
  newProduct,
  homeAdvertise,
  adminziyuanList,
  getTitleLists,
  getOnecoupon,
  UpdateOnecoupon,
  queryCouponData,
  delCouponItem,
  returnApplyList,
 homebranddele,productList,adminminioupload,  };








